<template>
	<view>
		<view class="place-view">
			<view class="place-addres" v-if="addreing" @click="addRess()">+ 新增收货地址</view>
			<!-- 已选中收货地址 -->
			<view class="goods-address" v-if="!addreing" @click="addRess()">
				<view class="goods-address-left"><image src="../../static/coen/address.png" mode="widthFix"></image></view>
				<view class="goods-address-in">
					<view>{{addressing.detailInfo}}</view>
					<view class="goods-address-name">
						<text>{{addressing.userName}}</text>
						<text>{{addressing.telNumber}}</text>
					</view>
				</view>
				<view class="goods-address-right"><image src="../../static/coen/jiantou.png" mode="widthFix"></image></view>
			</view>
			<view class="place-time">
				<image src="../../static/coen/times.png" mode="widthFix"></image>
				<text>立即送出</text>
			</view>
		</view>
		<!-- 菜单 -->
		<view class="place-view">
			<view>
				<block v-for="(item, index) in diszeroarr" :key="index">
					<view class="order-view">
						<view class="order-img"><image :src="item.image" mode="aspectFill"></image></view>
						<view class="order-title">
							<text>{{item.input}}</text>
							<text>{{item.amount}}</text>
						</view>
						<view class="order-price">单价:¥{{ item.price }}</view>
					</view>
				</block>
			</view>
		</view>
		<!-- 配送费 -->
		<view class="place-view">
			<view class="Delivery">配送费：¥{{physical}}</view>
		</view>
		<!-- 高度 -->
		<view style="height: 140upx;"></view>
		<!-- 支付 -->
		<view class="payment">
			<view class="payment-left">
				<text>合计</text>
				<text>¥{{payment}}</text>
			</view>
			<view class="payment-right">去支付</view>
		</view>
		<!-- 提示组件 -->
		<!-- <HMmessages ref="HMmessages" @complete="HMmessages = $refs.HMmessages" @clickMessage="clickMessage"></HMmessages> -->
	</view>
</template>

<script>
	export default{
		data() {
			return {
				addreing: true,
				diszeroarr:[],
				openid:"",
				payment:"",
				physical:"",
				marketopenid:"",
				marketname:"",
				marketlogo:"",
				// 收货地址
				addressing:{}
			}
		},
		methods:{
			addRess(){
				uni.chooseAddress({
				  success:(res)=>{
				    console.log(res)
					this.addressing = res
					this.addreing = false
				  }
				})
			}
		},
		onLoad(e) {
			// 上个页面传过来的参数
			console.log(e)
			let strorder=JSON.parse(e.ide)
			console.log(strorder)
			// 商品数据
			this.diszeroarr = strorder.diszeroarr
			// openid
			this.openid = strorder.openid
			// 支付的价格
			this.payment = strorder.payment
			// 配送费
			this.physical = strorder.physical
			// 商家标识
			this.marketopenid = strorder.marketopenid
			// 商家名称
			this.marketname = strorder.marketname
			// 商家logo
			this.marketlogo = strorder.marketlogo
		}
	}
</script>

<style>
page {
	background: #f4f4f4;
}
.place-view {
	background: #ffffff;
	margin: 20upx;
	border-radius: 9upx;
	padding: 35upx 15upx;
}
.place-addres {
	border: 1rpx solid #ffb000;
	width: 400upx;
	height: 80upx;
	line-height: 80upx;
	border-radius: 50upx;
	text-align: center;
	color: #ffb000;
	margin: 0 auto;
	font-size: 30upx;
}
.place-time image {
	width: 40upx;
	height: 40upx;
	padding-right: 20upx;
}
.place-time {
	display: flex;
	align-items: center;
	font-size: 30upx;
	border-top: 1rpx solid #f4f4f4;
	padding-top: 35upx;
	margin-top: 35upx;
}
/* 菜单 */
.order-view {
	display: flex;
	height: 150upx !important;
	overflow: hidden;
	margin-bottom: 15upx;
	font-size: 30upx;
}
.order-view text {
	display: block;
}
.order-img {
	width: 200upx !important;
	height: 150upx !important;
	padding-right: 15upx;
}
.order-img image {
	width: 100%;
	height: 100%;
}
.order-title {
	flex-grow: 1;
}
.order-title text:nth-child(2) {
	color: #999999;
	font-size: 25upx;
}
.Delivery {
	display: flex;
	justify-content: flex-end;
	font-size: 30upx;
}
/* 支付 */
.payment {
	background: #ffffff;
	height: 120upx;
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 30upx;
}
.payment-left {
	display: flex;
	align-items: center;
	font-size: 30upx;
}
.payment-left text:nth-child(2) {
	font-weight: bold;
	font-size: 32upx;
}
.payment-right {
	background: #07c160;
	color: #ffffff;
	padding: 20upx 60upx;
	font-size: 30upx;
	border-radius: 7upx;
}
/* 收货地址 */
.goods-address-left {
	width: 40upx;
	height: 40upx;
	padding-right: 20upx;
}
.goods-address-left image {
	width: 40upx;
	height: 40upx;
}
.goods-address-name {
	display: flex;
	align-items: center;
	font-size: 28upx;
	padding-top: 10upx;
}
.goods-address-right {
	width: 40upx;
	height: 40upx;
}
.goods-address-right image {
	width: 40upx;
	height: 40upx;
}
.goods-address {
	display: flex;
	align-items: center;
}
.goods-address-in {
	flex-grow: 1;
	font-size: 30upx;
}
.goods-address-name text:nth-child(1) {
	padding-right: 10upx;
}
</style>
